import { request } from '../request';

export interface CalcResponse<T = any> {
  result: T;
}

// 统一计算接口
export function fetchCalculate<T = any>(formId: string, data: any) {
  return request<CalcResponse<T>>({
    url: `/calculate/${formId}`,
    method: 'post',
    data
  });
}

// 统一生成报告接口，返回二进制流
export function fetchGenerateReport(formId: string, data: any) {
  return request<Blob, 'blob'>({
    // ← 在这里显式传入 'blob' 泛型
    url: `/report/${formId}`,
    method: 'post',
    data,
    responseType: 'blob' // 现在合法了
  });
}
